<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="/lottery/js/validate.js"></script>
<link href="/lottery/css/common.css" type="text/css" rel="stylesheet" />
<title>添加题目</title>
</head>

<body>
<div id="man_zone">
	<c:if test="${empty question.questionId}">
		<div class="operation_addtile">
			添加题目
		</div>
	</c:if>
	<c:if test="${!empty question.questionId}">
		<div class="operation_addtile">
			修改题目
		</div>
	</c:if>
<form action="<c:url value="/admin/question.do?action=insertAndUpdate"/>" method="post"
	name="insertAndUpdateForm" id="insertAndUpdateForm" onSubmit="return checkQuestionForm()" >
	
<c:set var="typeArray" value="0 选择题,1 其他"/>
<c:set var="resultArray" value="A,B,C,D"/>

<c:set var="statusArray" value="${fn:split(typeArray, ',')}"/>
<c:set var="statusResult" value="${fn:split(resultArray, ',')}"/>


<input type="hidden" name="id" value="<c:out value="${question.questionId}"/>"/>
<table width="99%" border="0" align="center" cellpadding="3"
	cellspacing="1" class="table_style">
	<tr>
		<td width="18%" class="left_title_1">题目标题</td>
		<td width="82%"><input type="text" name="content"
			id="content" value="<c:out value="${question.questionContent}"/>" title="请输入题目标题" size="80"/>
			<SPAN class="button_title"">
			<c:out value="${message}"/>
			</SPAN>
			</td>
	</tr>
	<tr>
		<td class="left_title_2">题目类型</td>
		<td>
			<select name="questionType" id="questionType">
				<c:if test="${!empty question.questionType}">
				<c:forEach var="statusArrayItem" items="${statusArray}">
					<c:set var="codeAndStatus" value="${fn:split(statusArrayItem, ' ')}" />
					<option value="${codeAndStatus[0]}"
					<c:if test="${codeAndStatus[0] == question.questionType}"> selected="selected"</c:if>
					<c:if test="${codeAndStatus[0] != question.questionType}"> disabled="disabled"</c:if>>
					${codeAndStatus[1]}
					</option>
				</c:forEach>
				</c:if>
				<c:if test="${empty question.questionType}">
					<option value="0" selected="selected">选择题</option>
					<option value="0" disabled="disabled">其他</option>
				</c:if>
			</select>		
		</td>
	</tr>
	<tr>
		<td  class="title_answer">题目答案</td>
		<td></td>
	</tr>
	
	<c:if test="${!empty reslutList}">
		<c:forEach var="item" items="${reslutList}" varStatus="i">
		<tr>
			<td  class="left_title_${i.index%2 +1 }">选项${item.resultSn}</td>
			<td><input type="text" name="result${item.resultSn}"
				id="result${item.resultSn}" title="请输入选项${item.resultSn}" size="30" value="${item.content}"/></td>
		</tr>
		</c:forEach>
	</c:if>
	
	<c:if test="${empty reslutList}">
	<tr>
		<td  class="left_title_2">选项A</td>
		<td><input type="text" name="resultA"
			id="resultA" title="请输入选项A" size="30"/></td>
	</tr>
	<tr>
		<td  class="left_title_1">选项B</td>
		<td><input type="text" name="resultB"
			id="resultA" title="请输入选项B" size="30"/></td>
	</tr>
	<tr>
		<td  class="left_title_2">选项C</td>
		<td><input type="text" name="resultC"
			id="resultA" title="请输入选项C" size="30"/></td>
	</tr>
	<tr>
		<td  class="left_title_1">选项D</td>
		<td><input type="text" name="resultD"
			id="resultA" title="请输入选项D" size="30"/></td>
	</tr>
	</c:if>
	
	<tr>
		<td class="left_title_2">正确选项</td>
		<td>
			<select name="isSolution" id="isSolution">
				<c:if test="${!empty reslutSn}">
					<c:forEach var="item" items="${statusResult}">
					<option value="${item}"
					<c:if test="${item == reslutSn}"> selected="selected"</c:if>>
						${item}
					</option>
					</c:forEach>
				</c:if>
				<c:if test="${empty reslutSn}">
				<option value="A" selected="selected">A</option>
				<option value="B">B</option>
				<option value="C">C</option>
				<option value="D">D</option>
				</c:if>
			</select>		
		</td>
	</tr>
	<tr bgcolor="#FFFFFF">
		<td>&nbsp;</td>
		<td>
		<input type="submit" value="提交" /> 
		
		</td>
	</tr>
</table>

</form>
</div>
</body>
</html>

